package com.zyh.system.supermark1.controller;

import com.zyh.system.supermark1.domain.User;
import com.zyh.system.supermark1.service.impl.BuyCarServiceImpl;
import com.zyh.system.supermark1.service.impl.GoodsServiceImpl;

import java.util.Scanner;

public class BuyIndex {
    public static final Scanner INPUT = new Scanner(System.in);
    public static final GoodsServiceImpl SERVICE_IMPL = new GoodsServiceImpl();
    public static final BuyCarServiceImpl CAR_SERVICE = new BuyCarServiceImpl();
    public static final UserIndex USER_INDEX = new UserIndex();


    public void buyIndex(User user) {
        while (true) {
            System.out.println("*********************电器商城********************************");
            System.out.println("                    1.商品购买                               ");
            System.out.println("                    2.展示商品                               ");
            System.out.println("                    3.添加商品                               ");
            System.out.println("                    4.我的购物车                             ");
            System.out.println("                    5.个人信息                               ");
            System.out.println("                    6.注销                                   ");
            System.out.println("*********************电器商城********************************");
            System.out.println("请输入菜单：");
            int choice = INPUT.nextInt();
            switch (choice) {
                case 1://1.商品购买
                    SERVICE_IMPL.shopping();
                    break;
                case 2://2.展示商品
                    SERVICE_IMPL.showAllGoods();
                    break;
                case 3://2.添加商品
                    SERVICE_IMPL.addGoods();
                    break;
                case 4://3.我的购物车
                    CAR_SERVICE.showBuyCar();
                    break;
                case 5://4.个人信息
                    CAR_SERVICE.showUserInfo(user);
                    break;
                default://4.注销
                    System.out.println("注销成功");
                    USER_INDEX.userIndex();
            }
        }
    }
}
